All Functions of Week 9

element_text

{GGPLOT2}

Customise text in GGPLOT2

with

{base}

evaluate expression in the context of a data frame

relevel

{stats}

Set a reference level for a factor variable

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

setwd

{base}

Set Working Directory

factor

{base}

Create a factor

labs

{GGPLOT2}

Customise labels in GGPLOT2

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

levels

{base}

Get levels of a factor

modelsummary

{modelsummary}

Creates regression and data tables

droplevels

{base}

Drop Unused Levels from Factors

log

{base}

log (default base = e)

geom_point

{GGPLOT2}

Generates a scatter plot

mutate

{dplyr}

Create new variables

as.character

{base}

Coerce a vector to character

theme

{GGPLOT2}

Customize ggplot themes

ylab

{GGPLOT2}

Label the y axis (ggplot)

prop.table

{base}

Transform frequency table into table of proportions

as.factor

{base}

Coerce a vector to factor

group_tt

{tinytable}

Grouping in tinytable

geom_smooth

{GGPLOT2}

Generates a smoothed conditional means curve / line

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

mean

{base}

Get mean of a vector

ifelse

{base}

Return a or b depending on the value of test

write.csv

{utils}

write a csv file to a data frame

sum

{base}

Get sum of numeric values or a vector

lm

{stats}

Fit linear models using least squares

sapply

{base}

Apply a function over a vector or list and simplify the result

margin

{GGPLOT2}

Set margins around plot elements (used inside theme elements)

library

{base}

Load an R package

theme_latex

{tinytable}

A theme for modelsummary/tinytable tables

factor

{base}

Create factor variables

recode

{dplyr}

Recode a variable

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

is.na

{base}

Check if a value is NA/elements of vector are NA

xlab

{GGPLOT2}

Label the x axis (ggplot)

c

{base}

Combine values/vectors into a vector

replace

{base}

Replace elements in a vector

filter

{dplyr}

Filter out rows of a data frame according to logical vector

read_csv

{readr}

Read CSV files

as.numeric

{base}

Coerce a vector to numeric

ggplot

{GGPLOT2}

Create a ggplot graph

confint

{stats}

Calculate confidence Intervals for Model Parameters

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

median

{stats}

Get median of a vector

fct_relevel

{forcats}

Reorder factor levels by hand

list

{base}

Create a list object

geom_bar

{GGPLOT2}

Generates a bar chart

summary

{base}

Obtain summary statistics or detailed regression output

The end!